#lang sicp
(define (make-queue)
  (cons '() '()))

(define (empty-queue? q)
  (null? (car q)))

(define (front-pointer q)
  (car q))
(define (rear-pointer q)
  (cdr q))

(define (set-front-pointer! q v)
  (set-car! q v))

(define (set-rear-pointer! q v)
  (set-cdr! q v))

(define (insert-queue! q v)
  (let ((new-item (list v)))
    (cond ((empty-queue? q)
           (set-front-pointer! q new-item)
           (set-rear-pointer! q new-item))
          (else
           (set-cdr! (rear-pointer q) new-item)
           (set-rear-pointer! q new-item)))
    (print-queue q)))

(define (delete-queue! q)
  (cond ((empty-queue? q)
         (error "empty queue!"))
        (else
         (set-front-pointer! q (cdr (front-pointer q)))))
  (print-queue q))

(define (print-queue q)
  (newline)
  (display (front-pointer q)))


(define q1 (make-queue))
(insert-queue! q1 'a)
(insert-queue! q1 'b)